home *** CD-ROM | disk | FTP | other *** search
/ Pascal Super Library / Pascal Super Library (CW International)(1997).bin / LIBRARY / CMPLTPAS / FACTRIAL.PAS < prev    next >
Pascal/Delphi Source File  |  1986-05-05  |  344b  |  13 lines

  1. {<<<< Factorial >>>>}
  2. { From: COMPLETE TURBO PASCAL by Jeff Duntemann  }
  3. { Scott, Foresman & Co. 1986  ISBN 0-673-18600-8 }
  4. { Described in section 14.4 -- Last mod 2/1/86   }
  5. { Overflows for all N > 7 }
  6.  
  7. FUNCTION Factorial(N : Integer) : Integer;
  8.  
  9. BEGIN
  10.   IF N > 1 THEN Factorial := N * Factorial(N-1)
  11.     ELSE Factorial := 1
  12. END;
  13.